<!-- 首页 -->
<template>
  <view class="container">
    <view class="header">
      <text class="title">商城首页</text>
    </view>
    <view class="content">
      <text class="welcome">欢迎访问商城系统</text>
    </view>
  </view>
</template>

<script setup>
  import { onLoad, onPullDownRefresh } from '@dcloudio/uni-app';
  import sheep from '@/sheep';
  import $share from '@/sheep/platform/share';

  onLoad((options) => {
    // #ifdef MP
    // 小程序识别二维码
    if (options.scene) {
      const sceneParams = decodeURIComponent(options.scene).split('=');
      console.log('sceneParams=>', sceneParams);
      options[sceneParams[0]] = sceneParams[1];
    }
    // #endif

    // 解析分享信息
    if (options.spm) {
      $share.decryptSpm(options.spm);
    }

    // 进入指定页面(完整页面路径)
    if (options.page) {
      sheep.$router.go(decodeURIComponent(options.page));
    }
  });

  // 下拉刷新
  onPullDownRefresh(() => {
    setTimeout(function () {
      uni.stopPullDownRefresh();
    }, 800);
  });
</script>

<style scoped>
  .container {
    padding: 20rpx;
  }
  .header {
    height: 80rpx;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1rpx solid #eee;
    margin-bottom: 30rpx;
  }
  .title {
    font-size: 36rpx;
    font-weight: bold;
  }
  .content {
    padding: 40rpx;
    text-align: center;
  }
  .welcome {
    font-size: 32rpx;
    color: #333;
  }
</style>
